//
//  RankCell.m
//  MoGuRadio
//
//  Created by dlios on 15-6-5.
//  Copyright (c) 2015年 mogu.com 蘑菇科技. All rights reserved.
//

#import "RankCell.h"

@interface RankCell ()

@property (nonatomic, retain) UIImageView *tagImage;
@property (nonatomic, retain) UIImageView *TimeImage;
@end

@implementation RankCell

- (void)dealloc
{
    [_TimeLabel release];
    [_tagImage release];
    [_TimeImage release];
    [_rankImageV release];
    [_rankNameLabel release];
    [_ranklabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.rankImageV = [[UIImageView alloc] init];
        self.rankImageV.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.rankImageV];
        [_rankImageV release];
        
        self.rankNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.rankNameLabel];
        self.rankNameLabel.font = [UIFont boldSystemFontOfSize:15];
        self.rankNameLabel.textColor = [UIColor whiteColor];
        [_rankNameLabel release];
        
        self.ranklabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.ranklabel];
        self.ranklabel.numberOfLines = 1;
        self.ranklabel.font = [UIFont systemFontOfSize:13];
        //到边远后保留整个字符
        self.ranklabel.lineBreakMode = NSLineBreakByCharWrapping;
        //self.ranklabel.alpha = 0.5;
        [self.ranklabel sizeToFit];
        self.ranklabel.textColor = [UIColor whiteColor];
        [_ranklabel release];
        
        self.tagImage = [[UIImageView alloc] init];
        self.tagImage.image = [UIImage imageNamed:@"rankbiaoqian1.png"];
        [self.contentView addSubview:self.tagImage];
        self.tagImage.alpha = 0.5;
        [_tagImage release];
        
        self.tagDetailLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.tagDetailLabel];
        self.tagDetailLabel.font = [UIFont systemFontOfSize:12];
        //self.tagDetailLabel.alpha = 0.5;
        [self.tagDetailLabel sizeToFit];
        self.tagDetailLabel.textColor = [UIColor whiteColor];
        [_tagDetailLabel release];
        
        self.TimeImage = [[UIImageView alloc] init];
        self.TimeImage.image = [UIImage imageNamed:@"ssjNewTime.png"];
        [self.contentView addSubview:self.TimeImage];
        self.TimeImage.alpha = 0.5;
        [_TimeImage release];
        
        self.TimeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.TimeLabel];
        self.TimeLabel.font = [UIFont systemFontOfSize:12];
        //self.TimeLabel.alpha = 0.5;
        [self.TimeLabel sizeToFit];
        self.TimeLabel.textColor = [UIColor whiteColor];
        [_TimeLabel release];
        
    }
    
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.contentView.bounds.size.width / 5;
    CGFloat height = self.contentView.bounds.size.height;
    //左侧图片
    self.rankImageV.frame = CGRectMake (width / 23, height / 80, width / 1, height / 1.01);
    self.rankImageV.contentMode  = UIViewContentModeScaleAspectFit;
    //圆角
    self.rankImageV.layer.cornerRadius = 19;
    self.rankImageV.layer.masksToBounds = YES;
    
    //黑子大体名单
    self.rankNameLabel.frame = CGRectMake(width + 10, 0, width * 4, height / 3);
    
    //灰体排名介绍
    self.ranklabel.frame = CGRectMake(width + 10, 8 + height / 4, width * 3, height / 3);
    
    //方形标签和类别
    self.tagImage.frame = CGRectMake(width + 10, 42 + height / 4, width / 6, height / 7);
    self.tagDetailLabel.frame = CGRectMake(width + 25, 32.5 + height / 4, width / 1, height / 3);
    
    //圆形标签和更新时间
    self.TimeImage.frame = CGRectMake(width + 79, 42 + height / 4, width / 6, height / 7);
    self.TimeLabel.frame = CGRectMake(width + 95, 33 + height / 4, width / 1, height / 3);
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
